<template>
	<!-- generate act_generate -->
	<view :class="['generate flex_bw', shopInfo.id ? 'act_generate' : '']">
		<view class="flex">
			<view class="img">
				<image class="empty_img" :src="$imgsUrl('0x72506294')" mode=""></image>
				<view class="img_cover" @tap.stop="previewImg">
					<image :src="shopInfo.cover" mode=""></image>
				</view>
				<view class="del_icon" @tap.stop="deleSelect">
					<image :src="$imgsUrl('0x72506296')" mode=""></image>
				</view>
			</view>
			<view class="generate_info flex">
				<view class="empty_txt">请选择产品参考图</view>
				<view class="shop_tit u-line-1">{{ shopInfo.name }}</view>
				<view class="shop_desc u-line-1">{{ shopInfo.desc }}</view>
			</view>
		</view>
		<view class="submit flex_center" @tap.stop="submit">
			<image :src="$imgsUrl('0x72506295')" mode=""></image>
			<view class="">立即生成</view>
		</view>
	</view>
</template>

<script>
export default {
	name: "generate",
	props: {
		shopInfo: {
			type: Object,
			default: () => {
				return {
					id: "",
					cover: `https://static.jinzhuangli.com/upload/20240722/1815279609314115584.jpg?x-oss-process=image/resize,p_55/quality,q_65/format,webp`,
					name: "商品名称商品名称",
					desc: "商品规格字段 · 商品规格字商品规格字段 · 商品规格字"
				};
			}
		}
	},
	data() {
		return {};
	},
	methods: {
		// 提交
		submit() {
			if (!this.shopInfo.id) return;
			console.log("点击提交");
		},
		previewImg() {
			uni.previewImage({
				urls: [this.shopInfo.cover]
			});
		},
		deleSelect() {
			this.$emit("deleSelect", this.shopInfo);
		}
	}
};
</script>

<style scoped lang="less">
.generate.act_generate {
	.generate_info {
		align-items: flex-start;
		font-size: 24rpx;
		flex-direction: column;

		.shop_tit {
			display: inline-block;
			font-weight: bold;
			color: #222;
			padding-bottom: 8rpx;
		}
		.shop_desc {
			display: inline-block;
			color: #888888;
		}
		.empty_txt {
			display: none;
		}
	}
	.img {
		.img_cover {
			display: flex;
		}
		.del_icon {
			display: flex;
		}
	}
	.empty_img {
		display: none;
	}
	.submit {
		background: linear-gradient(89deg, #486cf6 0%, #b458ff 100%);
	}
}
.generate {
	position: fixed;
	bottom: calc(52rpx + env(safe-area-inset-bottom) / 2);
	left: 50%;
	transform: translateX(-50%);
	width: 674rpx;
	height: 108rpx;
	border-radius: 96rpx;
	color: #333333;
	background-color: #fff;
	padding: 16rpx;
	box-shadow: 0px 0 15px 0px rgba(0, 0, 0, 0.08);
	// https://static.jinzhuangli.com/upload/20240722/1815279609314115584.jpg?x-oss-process=image/resize,p_55/quality,q_65/format,webp
	.img {
		border-radius: 0;
		position: relative;
	}
	.submit {
		background: #ccc;
		border-radius: 74rpx;
		width: 212rpx;
		height: 76rpx;
		color: #fff;
		font-size: 30rpx;
		font-weight: bold;
		image {
			width: 30rpx;
			height: 30rpx;
			margin-right: 12rpx;
		}
	}
	.del_icon {
		display: none;
		padding: 8rpx;
		position: absolute;
		right: -12rpx;
		top: -5px;
		z-index: 3;
		image {
			width: 24rpx;
			height: 24rpx;
		}
	}
	.img_cover {
		width: 100%;
		height: 100%;
		display: none;
		border-radius: 50%;
		overflow: hidden;
	}
	.img {
		width: 70rpx;
		height: 70rpx;
		margin-right: 24rpx;
	}
	.generate_info {
		height: 100%;
		width: 304rpx;
		.shop_tit,
		.shop_desc {
			display: none;
			width: 100%;
		}
		.empty_txt {
			font-weight: bold;
			font-size: 28rpx;
			color: #333333;
		}
	}
}
</style>
